package com.tensquare.ai.controller;

import com.tensquare.ai.service.CnnService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Map;
/**
 *  结果:
 *   {
 *       "ai": 0.3,
 *       "db":0.5,
 *       "web":0.2
 *   }
 */
@RequestMapping("/article")
@RestController
@CrossOrigin
public class ArticleController {

    @Autowired
    private CnnService cnnService;


    /**
     * 文章分类预测方法
     */
    @RequestMapping(value = "/yuce",method = RequestMethod.POST)
    public Map<String,Double> yuce(@RequestBody Map data){
        //文章内容
        String content = (String)data.get("content");
        //进行预测
        return cnnService.yuce(content);
    }

}
